home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97b.txt
/
000059_icon-group-sender _Thu Sep 4 15:02:46 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Thu, 4 Sep 1997 15:02:45 -0500 (EST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA25059; Thu, 4 Sep 1997 13:02:45 -0700
To: icon-group
Date: 04 Sep 1997 10:57:37 -0400
From: davidf@mks.com (David J. Fiander)
Message-Id: <uoh69f7oe.fsf_-_@davidf-nt.mks.com>
Organization: Mortice Kern Systems Inc.
Sender: icon-group-request
References: <comp.lang.dylan.199708151441.PAA09067@gairsay.aiai.ed.ac.uk>
Subject: n-ary comparison operators (was Re: Better Dylan syntax?)
Errors-To: icon-group-errors
Status: RO
Gareth McCaughan <gjm11@dpmms.cam.ac.uk> writes:
>
>
> Erik Naggum wrote:
>
> > hm. in a < b `<' is a binary operator, while it is ternary in a < b < c,
> > and n-ary in a < b < ... < z. although I know of no language that has
> > anything but binary infix operators, I get the impression from the above
> > that you do.
>
> Yes. BCPL does it. "a < b <= c ~= d" means "a<b and b<=c and c/=d".
> I don't know of any other languages with the same feature, but I'd
> be surprised if BCPL were the only one.
>
Icon supports n-ary infix operators:
a < b < c ~= d
produces the same result as BCPL. This works because
comparisions are left associative, and successful comparisons
return the right operand. That is, the above expression is
equivalent to
(((a < b) < c) ~= d)
and if a < b, then b is compared to c, and so on. If a >= b,
then the expression fails, and none of the rest of it is evaluated.